function [] = makeHistogram_and_percentilePlot(values, outputFolder, filePrefix, xlabel_text, varargin)
	if nargin >= 5
		NumHistogramBars = varargin{1};
	else
		NumHistogramBars = 15;
	end
	if nargin >= 6
		xmax = varargin{2};
	else
		xmax = {};
	end
	if nargin >= 7
		ymax = varargin{3};
	else
		ymax = {};
	end
	
	% Make a histogram
	histogramFile = sprintf('%s/%s_Histogram.pdf', outputFolder, filePrefix);
	
	if isempty(xmax)
		[histFreq, histXout] = hist(values, NumHistogramBars);
	else
		increment = xmax/NumHistogramBars;
		edges = increment/2:increment:xmax-increment/2;
		[histFreq, histXout] = hist(values, edges);
	end
	h = figure;
	set(gcf, 'Units', 'Inches', 'Position', [0, 0, 10, 5], 'PaperUnits', 'Inches', 'PaperSize', [9.2, 5]);
	bar(histXout, histFreq/sum(histFreq)*100, 1, 'FaceColor', 'white', 'LineWidth',1);
	xlabel(xlabel_text, 'fontsize',16);
	ylabel('Frequency (%)', 'fontsize',16);
	if ~isempty(xmax)
		xlim([0,xmax]);
	end
	if ~isempty(ymax)
		ylim([0,ymax]);
	end
	set(gca,'TickLength',[0 0]); % Remove the xticks ticks
	title('', 'fontsize',18);
	set(gca, 'FontSize', 18);
	print(h, '-dpdf', histogramFile);
	close(h);
	
	% Make percentile plot
	percentilePlotFile = sprintf('%s/%s_PercentilePlot.pdf', outputFolder, filePrefix);
	x = 0:0.0001:1;
	q = quantile(values, x);
	h = figure;
	set(gcf, 'Units', 'Inches', 'Position', [0, 0, 10, 5], 'PaperUnits', 'Inches', 'PaperSize', [9.2, 5]);
	plot(q,x, 'LineWidth', 2, 'Color', 'black'); title('', 'fontsize',18);
	xlabel(xlabel_text, 'fontsize',16);
	ylabel('Quantile', 'fontsize',16);
	if ~isempty(xmax)
		xlim([0,xmax]);
	end
	set(gca, 'FontSize', 18);
	print(h, '-dpdf', percentilePlotFile);
end
